Skip to content

Support F_GETFL and F_SETFL for fcntl #4212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged

Conversation

tiif
Copy link
Member

@tiif tiif commented Feb 26, 2025

This PR supports F_SETFL and F_GETFL flags for fcntl. In this implementation, F_SETFL can only set O_NONBLOCK flag (and file access mode flag like O_RDONLY, but that will be ignored).

If setfl is called while a fd is blocking, that fd will not be affected by the new flag value and will continue blocking like normal until a read/write wakes it up (it acts like it never knew the setfl has happened). But any operation after setfl will see the new flag value.

The interaction between these fcntl operations and blocking fd is summarised here.

Fixes #4119

Copy link
Member Author

@tiif tiif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete labels Feb 26, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the first round of comments. Sorry for the long wait!

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Waiting for a review to complete label Apr 9, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 9, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Apr 9, 2025
@tiif
Copy link
Member Author

tiif commented Apr 12, 2025

On the latest commit b22019d, I made all the tests in this PR to use isolation mode.

@tiif
Copy link
Member Author

tiif commented Apr 22, 2025

Just a heads up, this PR will stall for a while due to exam prep, but I will be back on it after rust week.

@rustbot

This comment has been minimized.

@tiif
Copy link
Member Author

tiif commented May 26, 2025

All feedback has been addressed :)

@rustbot ready

@tiif
Copy link
Member Author

tiif commented May 26, 2025

Is rustbot taking a break?

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label May 26, 2025
@tiif
Copy link
Member Author

tiif commented May 26, 2025

Trying one last time...

@rustbot label -S-waiting-on-author

@rustbot rustbot removed the S-waiting-on-author Status: Waiting for the PR author to address review comments label May 26, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. :)
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels May 26, 2025
@tiif
Copy link
Member Author

tiif commented May 27, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels May 27, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're almost there, just a few nits. :)
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels May 27, 2025
@RalfJung
Copy link
Member

You know you can land multiple GH suggestions as a single commit? :) Just go to the diff view, there's a button for that.

@tiif
Copy link
Member Author

tiif commented May 27, 2025

Ohh I didn't know that! Clicking one by one is indeed a bit annoying because the webpage will refresh for every commit.

Ah I saw the button now :)

@tiif
Copy link
Member Author

tiif commented May 27, 2025

@rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: Waiting for the PR author to address review comments label May 27, 2025
@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label May 27, 2025
@RalfJung
Copy link
Member

This looks great, thanks! Please squash the commits using ./miri squash. Then write @rustbot ready after you force-pushed the squashed PR.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels May 27, 2025
@tiif
Copy link
Member Author

tiif commented May 27, 2025

Done, thanks for the review :)

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels May 27, 2025
@RalfJung RalfJung added this pull request to the merge queue May 27, 2025
Merged via the queue into rust-lang:master with commit ac636db May 27, 2025
8 checks passed
@tiif tiif deleted the setfl branch May 27, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Waiting for a review to complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support F_SETFL and F_GETFL
3 participants